# 人工智能NLP-Agent数字人项目-04-基金数据问答任务工单V1.1-2025.2.13
import os
from langchain_openai import ChatOpenAI
from sentence_transformers import SentenceTransformer
from transformers import AutoTokenizer

# 定义模型分词器的路径
model_tokenizer_path =r"C:\Users\86166\OneDrive\桌面\Fay-fay-agent-edition0830\data\Tongyi-Finance-14B-Chat"

# 定义检索的最大结果数
TOP_K = 5

try:
    # 初始化大语言模型
    LLM = ChatOpenAI(
        temperature=0.01,
        model="moonshot-v1-128k",
        api_key="sk-yRt75JsxDaiKB0mbcaR280n0LZ9LiGgimZiFjLXMWGSHd2zA",
        base_url="https://api.moonshot.cn/v1"
    )
    print("大语言模型初始化成功")
except Exception as e:
    print(f"大语言模型初始化失败: {e}")

try:
    # 加载分词器
    TOKENIZER = AutoTokenizer.from_pretrained(model_tokenizer_path, trust_remote_code=True)
    print("分词器加载成功")
except Exception as e:
    print(f"分词器加载失败: {e}")